package com.ywy.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // 图片地址映射，handler为前台访问的目录，locations为files相对应的本地路径
        registry.addResourceHandler("/avatars/**").addResourceLocations("file:D://files/avatars/");
        registry.addResourceHandler("/resImages/**").addResourceLocations("file:D://files/resImages/");
    }
}
